import Vue from "vue";
import Vuex from "vuex";

Vue.use(Vuex);

export default new Vuex.Store({
  state: {
    icon: "",
    index: "",
    token: ""
  },
  mutations: {
    //底部按钮切换状态
    state_icon(state, icon) {
      state.icon = icon;
      sessionStorage.icon = icon;
    },
    state_index(state, index) {
      state.index = index;
      sessionStorage.index = index;
    },
    state_token(state, token) {
      state.token = token;
      window.sessionStorage.setItem('token', state.token);
    },
    state_id(state,id){
      state.id = id;
      sessionStorage.id = id;
    }
  },
  actions: {},
  modules: {}
});